﻿using System.Collections.Generic;
using System.ServiceModel;

namespace Metro.Kashikoi.ServiceContract.Item
{
    /// <summary>
    /// WCF client of the <c>IItemService</c>.
    /// </summary>
    public class ItemServiceClient : ClientBase<IItemService>, IItemService
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="LocationServiceClient"/> class.
        /// </summary>
        public ItemServiceClient() :
            base("item")
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="LocationServiceClient"/> class.
        /// </summary>
        /// <param name="remoteAddress">The remote address.</param>
        public ItemServiceClient(string remoteAddress) :
            base("item", remoteAddress)
        {
        }

        #endregion

        /// <summary>
        /// Creates a new item.
        /// </summary>
        /// <param name="item">The item to be created.</param>
        /// <returns>
        /// The newly created item.
        /// </returns>
        public StockItem CreateItem(StockItem item)
        {
            return base.Channel.CreateItem(item);
        }

        /// <summary>
        /// Updates the item.
        /// </summary>
        /// <param name="item">The item to be updated.</param>
        public void UpdateItem(StockItem item)
        {
            base.Channel.UpdateItem(item);
        }

        /// <summary>
        /// Deletes the item.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        public void DeleteItem(int itemId)
        {
            base.Channel.DeleteItem(itemId);
        }

        /// <summary>
        /// Gets all items.
        /// </summary>
        /// <returns>
        /// A list of item.
        /// </returns>
        public IList<StockItem> GetAllItems()
        {
            return base.Channel.GetAllItems();
        }

        /// <summary>
        /// Imports the items.
        /// </summary>
        /// <param name="path">The file path.</param>
        public void ImportItems(string path)
        {
            base.Channel.ImportItems(path);
        }

        /// <summary>
        /// Creates the charge department.
        /// </summary>
        /// <param name="chargeDepartment">The charge department.</param>
        /// <returns>
        /// The newly created charge department.
        /// </returns>
        public ChargeDepartment CreateChargeDepartment(ChargeDepartment chargeDepartment)
        {
            return base.Channel.CreateChargeDepartment(chargeDepartment);
        }

        /// <summary>
        /// Updates the charge department.
        /// </summary>
        /// <param name="chargeDepartment">The charge department.</param>
        public void UpdateChargeDepartment(ChargeDepartment chargeDepartment)
        {
            base.Channel.UpdateChargeDepartment(chargeDepartment);
        }

        /// <summary>
        /// Deletes the charge department.
        /// </summary>
        /// <param name="chargeDepartmentId">The charge department id.</param>
        public void DeleteChargeDepartment(int chargeDepartmentId)
        {
            base.Channel.DeleteChargeDepartment(chargeDepartmentId);
        }

        /// <summary>
        /// Gets all charge departments.
        /// </summary>
        /// <returns>
        /// A list of charge department.
        /// </returns>
        public IList<ChargeDepartment> GetAllChargeDepartments()
        {
            return base.Channel.GetAllChargeDepartments();
        }

        /// <summary>
        /// Gets the item.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="includeCategory">if set to <c>true</c>
        /// the category will be fetched.</param>
        /// <param name="includeVendor">if set to <c>true</c>
        /// the vendor will be fetched.</param>
        /// <param name="includeChargeDepartment">if set to <c>true</c>
        /// the charge department will be fetched..</param>
        /// <returns>
        /// The item.
        /// </returns>
        public StockItem GetItem(int id, bool includeCategory = true,
            bool includeVendor = true, bool includeChargeDepartment = true)
        {
            return base.Channel.GetItem(id, includeCategory, includeVendor,
                includeChargeDepartment);
        }
    }
}
